<template>
  <div class="list">
    <van-nav-bar
      title="搜索列表"
      left-arrow
      @click-left="$router.back()"
      fixed
      placeholder
    />

    <div class="listPage">
      <!-- <van-list v-model="loading" :finished="finished" @load="getList">
          <li v-for="item in list" :key="item._id">
            <p>{{ item.title }}</p>
          </li>
        </van-list> -->

      <commentList :API="searchApi" :params="{ key_word }" :refresh="true">
        <template #default="{ list }">
          <li v-for="item in list"
          :key="item._id"
          @click="
              $router.push({
                path: '/article',
                query: { id: item._id, title: item.title },
              })
            "
          >

          
            <p>{{ item.title }}</p>
          </li>
        </template>
      </commentList>
    </div>
  </div>
</template>

<script>
import { search as searchApi } from "@/api/api";
import commentList from "@/components/commonList.vue";
export default {
  name: "searchList",
  components: {
    'commentList': commentList,
  },
  data() {
    return {
      searchApi,
    };
  },
  computed: {
    key_word() {
      return this.$route.query.key_word;
    },
  },
  created() {},
  methods: {},
};
</script>

<style lang="less">
.listPage {
  li {
    border-bottom: 1px solid red;
    list-style: none;
    min-height: 30px;
  }
}
</style>